<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8"
          content="width=device-width,height=device-height,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"
          name="viewport">
    <title>美团录入</title>
    <link rel="stylesheet" href="https://heerey525.github.io/layui-v2.4.3/layui-v2.4.4/css/layui.css">
    <style>
        body {
            background: #00bdd4;
        }

        input {
            height: 38px;
            line-height: 1.3;
            line-height: 38px \9;
            border-width: 1px;
            border-style: solid;
            border-color: #c9c9c9;
            background-color: #fff;
            border-radius: 2px;
        }

        .btnshop {
            display: inline-block;
            width: 50%;
            height: 38px;
            line-height: 38px;
            padding: 0 18px;
            background-color: #009688;
            color: #fff;
            white-space: nowrap;
            text-align: center;
            font-size: 14px;
            border: none;
            border-radius: 2px;
            cursor: pointer;
            margin-bottom: 10px;
        }

        .left {
            width: 25%;
            float: right;
        }

        .right {
            width: 55%;
            float: right;
        }

        .msg {
            text-align: center;
            margin-top: 200px;
            padding-top: 15px;
            padding-left: 25px;
            background-color: #fff;
            border-radius: 4px;
        }

        .tj {
            margin-left: -30px;
            margin-top: 40px;
        }
    </style>
</head>
<body>
<div class="msg">
    <div style="display: flex;flex-direction: row;margin-bottom: 10px">
        <div class="left"><span>门店号</span></div>
        <div class="right"><input type="text" name="mm" id="mm" autocomplete="off" readonly></div>
    </div>
    <div style="display: flex;flex-direction: row;margin-bottom: 10px">
        <div class="left"><span style="color: red">*</span><span>姓名</span></div>
        <div class="right"><input type="text" name="xm" id="xm" autocomplete="off" placeholder="请输入姓名"></div>
    </div>
    <div style="display: flex;flex-direction: row;margin-bottom: 10px">
        <div class="left"><span style="color: red">*</span> <span>手机号</span></div>
        <div class="right"><input type="text" id="sjh" name="sjh" autocomplete="off" placeholder="请输入手机号" oninput = "value=value.replace(/[^\d]/g,'')"></div>
    </div>
    <div style="display: flex;flex-direction: row;margin-bottom: 10px">
        <div class="left"><span>消费金额</span></div>
        <div class="right"><input type="text" id="xf" name="xf" autocomplete="off" value="0"></div>
    </div>
    <div style="display: flex;flex-direction: row;margin-left: 100px;">
        <div style="display: flex;flex-direction: row;margin-bottom: 10px;margin-right: 66px">
            <div style="margin-right: 5px">
                <input type="radio" name="sex" checked=""  value="1">
            </div>
            <div style="display: inline-block;padding-top: 10px;">
                男
            </div>
        </div>
        <div style="display: flex;flex-direction: row;margin-bottom: 10px">
            <div style="margin-right: 5px">
                <input type="radio" name="sex" value="2">
            </div>
            <div style="display: inline-block;padding-top: 10px;">
                女
            </div>
        </div>
    </div>

    <div class="tj">
        <input id="btn" name="btn" class="layui-input btnshop" type="button" value="提交"/>
    </div>
</div>
</body>
<script type="text/javascript">
    var Feng = {
        ctxPath: "${ctxPath}",
        version: '${constants.getReleaseVersion()}'
    };
</script>
<script type="text/javascript"
        src="${ctxPath}/assets/common/libs/layui/layui.all.js?v=${constants.getReleaseVersion()}"></script>
<script src="https://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
<script type="application/javascript">
    let mm = '${yaoMa}';
    let obj = {};

    $(function () {
        $("#mm").val(mm);
    });

    $("#btn").on('click', function () {
        obj.xm = $("#xm").val();
        obj.mm = mm + "";
        obj.xf = $("#xf").val();
        obj.sjh = $("#sjh").val();
        obj.sex = $('input[name="sex"]:checked').val();
        if (obj.xm == "") {
            layer.msg('姓名不能为空！', {icon: 2,});
            return
        } else if (obj.sjh == "") {
            layer.msg('手机号不能为空！', {icon: 2});
            return
        } else if (obj.mm == "") {
            layer.msg('门店号不能为空！', {icon: 2});
            return
        } else {
            $.ajax({
                type: "POST",
                url: "/weiXinApi/insertMeiTuan",
                data: obj,
                async: false,
                success: function (data) {
                    if (data != "0") {
                        layer.msg('保存成功', {
                            icon: 1,
                            time: 2000 //2秒关闭（如果不配置，默认是3秒）
                        }, function () {
                            window.location.reload();
                        });
                    }
                }
            });
        }

    });

</script>
</html>